<template>
	<view>
		<!-- <view class="bj"></view> -->
		<view>
			<u-swiper :list="list5" @change="e => current = e.current" :autoplay="false">
				<view slot="indicator" class="indicator">
					<view class="indicator__dot" v-for="(item, index) in list5" :key="index"
						:class="[index === current && 'indicator__dot--active']">
					</view>
				</view>
			</u-swiper>
			<u-gap bgColor="transparent" height="15"></u-gap>
			
			<!-- <u-image  mode="scaleToFill" width="750rpx" :src="get_img+sys.live_nav_bg"></u-image> -->
		</view>
		<view class="title">
			<view class="">
				<img style="height: 35rpx;width: 35rpx;margin-right: 10rpx;" src="../../static/icon/yu.png"></img>
			</view>直播预告
		</view>
		<view class="yugao">
			<scroll-view class="scroll-view_x" scroll-x style="">
				<block v-for="(item,index) of player2" :key="index">
					<view class="yg" @click="go_play(item)">
						<view class="yg_01">
							<view :class="index!=0?'yg_01_1':'kong'"></view>
							<view class="yg_01_2">{{item.start_time}}</view>
							<view class="yg_01_1"></view>
						</view>
						<view class="yg_02">
							<view>
								<view class="yg_02_01">
									<img style="height: 100rpx;width: 100rpx;border-radius: 50%;"
										:src="item.cover_img"></img>
								</view>
								<view class="yg_02_02">{{item.anchor_name}}</view>
								<view class="yg_02_03">{{item.name}}</view>
							</view>
							<view class="yg_02_04">
								进入等待
								<view style="opacity: 0.0; height: 1px;">
									<subscribe room-id=""></subscribe>
								</view>
							</view>
						</view>
					</view>
				</block>
			</scroll-view>

		</view>
		<view class="icon" v-if="player2.length==''">
			<u-empty mode="list" width="50rpx" height="50rpx" icon="list" text="暂无预告">
			</u-empty>
		</view>
		<view class="title">
			<view class="">
				<img style="height: 35rpx;width: 35rpx;margin-right: 10rpx;" src="../../static/icon/yu.png"></img>
			</view>正在直播
		</view>
		<view class="playback">
			<block v-for="(item,index) of player1" :key="index">
				<view class="pb" @click="go_play(item)">
					<img style="width: 46vw;
					height: 46vw;
					border-radius: 5px;" :src="item.cover_img"></img>
					<!-- <view class="zbz">
						<view class="zbz_01">回放</view>
					</view>
					<view class="guank">122人观看 </view> -->
					<view class="rhm">
						<view class="rhm_l"><img style="height: 40rpx;width: 40rpx;border-radius: 20rpx;"
								:src="item.user.avatar"></img></view>
						<view class="rhm_r">{{item.anchor_name}}</view>
					</view>
					<view class="pb_tit">{{item.name}}</view>
				</view>
			</block>
		</view>
		<view class="icon" v-if="player1.length==''">
			<u-empty mode="list" icon="list" text="暂无直播">
			</u-empty>
		</view>
		<view class="title">
			<view class="">
				<img style="height: 35rpx;width: 35rpx;margin-right: 10rpx;" src="../../static/icon/yu.png"></img>
			</view>直播回放
		</view>
		<view class="playback">
			<block v-for="(item,index) of player3" :key="index">
				<view class="pb" @click="goBaack(item)">
					<img style="width: 46vw;
					height: 46vw;
					border-radius: 5px;" :src="item.cover_img"></img>
					<view class="zbz">
						<view class="zbz_01">回放</view>
					</view>
					<!-- <view class="guank">122人观看 </view> -->
					<view class="rhm">
						<view class="rhm_l"><img style="height: 40rpx;width: 40rpx;border-radius: 20rpx;"
								:src="item.user.avatar"></img></view>
						<view class="rhm_r">{{item.anchor_name}}</view>
					</view>
					<view class="pb_tit">{{item.name}}</view>
				</view>
			</block>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				get_img: this.$get_img,
				player1: [],
				player2: [],
				player3: [],
				sys: {},
				list5: [
					'https://cdn.uviewui.com/uview/swiper/swiper3.png',
					'https://cdn.uviewui.com/uview/swiper/swiper2.png',
					'https://cdn.uviewui.com/uview/swiper/swiper1.png',
				],

			}
		},
		onLoad() {
			this.sys = uni.getStorageSync("sys")
			this.get_player1()
			this.get_player2()
			this.get_player3()

		},
		methods: {
			get_player1() {
				let that = this
				this.$model.get("user/common/get_live?live_status=101").then(res => {
					if (res.code == 200) {
						that.player1 = res.data
					}
				})
			},
			go_play(item) {
				let customParams = encodeURIComponent(JSON.stringify({
					path: 'pages/index/livebroadcast',
					uid: 1
				}))
				uni.navigateTo({
					url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${item.roomid}&custom_params=${customParams}`
				})
				/* uni.navigateTo({
					url:'./live/liveroom?id='+item.id	
				}) */
			},
			goBaack(item) {
				uni.navigateTo({
					url: './live/liveback?id=' + item.id
				})
			},
			get_player2() {
				let that = this
				this.$model.get("user/common/get_live?live_status=102").then(res => {
					if (res.code == 200) {
						that.player2 = res.data
					}
				})

			},
			get_player3() {
				let that = this
				this.$model.get("user/common/get_live?live_status=103").then(res => {
					if (res.code == 200) {
						that.player3 = res.data
					}
				})
			},

		}
	}
</script>

<style lang="scss">
	.indicator {
		@include flex(row);
		justify-content: center;

		&__dot {
			height: 6px;
			width: 6px;
			border-radius: 100px;
			background-color: rgba(255, 255, 255, 0.35);
			margin: 0 5px;
			transition: background-color 0.3s;

			&--active {
				background-color: #ffffff;
			}
		}
	}

	.indicator-num {
		padding: 2px 0;
		background-color: rgba(0, 0, 0, 0.35);
		border-radius: 100px;
		width: 35px;
		@include flex;
		justify-content: center;

		&__text {
			color: #FFFFFF;
			font-size: 12px;
		}
	}

	.bj {
		z-index: -1;
		position: relative;
		height: 300rpx;
		width: 750rpx;
		background-color: #FB586A;
		border-radius: 0 0 20rpx 20rpx;
	}

	.title {
		display: flex;
		justify-content: center;
		font-size: 16px;
		font-weight: 600;
		padding: 10px;
	}

	.image {
		background-repeat: no-repeat;
		background-size: cover;
		background-attachment: fixed;
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100vh;
		z-index: -1;

	}

	.yg_02_02 {
		font-size: 25rpx;
	}

	.yg_02_03 {
		font-size: 25rpx;
	}

	.yugao {
		width: 100%;
		overflow: hidden;
		white-space: nowrap;
		margin-left: 10px;
	}

	.yg {
		width: 40vw;
		margin: 0 0 30px 0px;
		display: inline-block;
		text-align: center;
	}

	.yg_01 {
		display: flex;
		margin-bottom: 10px;
	}

	.yg_01_1 {
		height: 12px;
		border-bottom: 2px dotted #BCBCBC;
		flex-grow: 1;
	}

	.yg_01_2 {
		width: 100px;
		text-align: center;
		line-height: 20px;
		height: 20px;
		background-color: #F3F1F2;
		font-size: 12px;
		border-radius: 10px;
	}

	.yg_02 {
		background-color: #fff;
		box-shadow: 2px 0px 6px #F0F0F0;
		border-radius: 5px;
		padding: 0 0 20px 0px;
		position: relative;
		width: 36vw;
	}

	.yg_02_04 {
		position: absolute;
		bottom: -10px;
		left: 50%;
		background: linear-gradient(to right, #FB9B0A, #FB7608);
		color: #FADDB0;
		padding: 4px 0;
		border-radius: 20px;
		font-size: 13px;
		width: 80px;
		text-align: center;
		margin-left: -40px;
		// opacity: 0.0;
	}

	.playback {
		display: flex;
		flex-wrap: wrap;

	}

	.pb {
		background-color: #fff;
		border-radius: 5px;
		margin: 0 0 15px 3%;
		box-shadow: 2px 0px 6px #F0F0F0;
		position: relative;
		width: 46vw;
		height: auto;
	}

	.zbz {
		position: absolute;
		top: 0;
		left: 0;
		background-color: #FC466A;
		color: #E8DBCE;
		font-size: 10px;
		z-index: 99;
		padding: 0 8px 2px 2px;
		border-radius: 5px 8px 8px 0;
	}

	.guank {
		position: absolute;
		top: 0;
		left: 0;
		background-color: rgba(96, 105, 113, 0.5);
		color: #EBDCD9;
		font-size: 12px;
		padding: 0 4px 2px 65rpx;
		border-radius: 8px;
	}

	.rhm {
		position: absolute;
		bottom: 85rpx;
		margin-left: 10rpx;
		display: flex;
		color: #fff;
		line-height: 40rpx;
		font-size: 30rpx;
		/* background-color:red; */
	}

	.rhm_r {
		line-height: 20px;
		height: 20px;
		overflow: hidden;
		padding-right: 15px;
	}

	.pb_tit {
		font-weight: 800;
		text-align: center;
		height: 80rpx;
		line-height: 80rpx;
		padding: 0 10px;
		overflow: hidden;
	}

	.rhm_l {
		margin: 0 0 10rpx 5rpx;
	}
</style>
